(self.webpackChunkmp_webgl = self.webpackChunkmp_webgl || []).push([
  [316],
  {
    84715: (e, t, i) => {
      "use strict";
      i.r(t),
        i.d(t, {
          NavigationVisuals: () => NavigationVisuals,
          visPanoNavigation: () => w,
          visDollhouseNavigation: () => m,
          default: () => y,
        });
      var s = i(96909),
        o = i(37433),
        a = i(19674),
        n = i(82088),
        r = i(29539),
        h = i(39455),
        c = i(24930),
        l = i(59088),
        d = i(44019),
        p = i(51245),
        u = i(75892),
        g = i(35597);
      class NavigationVisuals {
        constructor(e, t, i) {
          (this.engine = e),
            (this.dynamicNumber = t),
            (this.smoothWalk = i),
            (this.active = !1),
            (this.draw = new o.M()),
            Promise.all([
              this.engine.getModuleBySymbol(s.y.WEBGL_RENDERER),
              this.engine.market.waitForData(d.P),
            ]).then(([e, t]) => {
              this.draw.addToScene(e.getScene()),
                (this.subscription = t.onChanged(() =>
                  this.update(this.draw, t)
                )),
                this.subscription.cancel();
            }),
            this.engine.getModule(c.default).then((e) => {
              const t = "Navigation";
              [
                {
                  header: t,
                  setting: "Debugger Enabled",
                  initialValue: () => this.active,
                  onChange: (e) => this.toggle(e),
                },
                {
                  header: t,
                  setting: "Max transition dist",
                  initialValue: () => h.E.longerTransitionMaxDist,
                  range: [3, 50],
                  rangePrecision: 1,
                  onChange: (e) => (h.E.longerTransitionMaxDist = e),
                },
                {
                  header: t,
                  setting: "accel",
                  initialValue: () => this.dynamicNumber.acceleration,
                  range: [1, 60],
                  rangePrecision: 0.5,
                  onChange: (e) => {
                    this.dynamicNumber.setAccel(e);
                  },
                },
                {
                  header: t,
                  setting: "top speed",
                  initialValue: () => this.dynamicNumber.maxSpeed,
                  range: [1, 40],
                  rangePrecision: 0.5,
                  onChange: (e) => this.dynamicNumber.setMaxSpeed(e),
                },
                {
                  header: t,
                  setting: "queue ms",
                  initialValue: () => this.smoothWalk.repeatedQueueDelayMS,
                  range: [0, 1e3],
                  onChange: (e) => (this.smoothWalk.repeatedQueueDelayMS = e),
                },
              ].forEach((t) => e.registerMenuEntry(t));
            });
        }
        toggle(e) {
          this.active !== e &&
            (e || this.draw.toggleAll(!1),
            e || this.subscription.cancel(),
            e && this.subscription.renew(),
            (this.active = e));
        }
        update(e, t) {
          const i = this.engine.market.tryGetData(u.Z),
            s = this.engine.market.tryGetData(l.M_),
            o = this.engine.market.tryGetData(g.O);
          e &&
            i &&
            s &&
            o &&
            (e.toggleAll(!1),
            t.hit &&
              p.$4.hasFloorId(t.hit.object) &&
              (o.isInside()
                ? w(e, i, s, t.hit.intersection)
                : m(e, i, t.hit.intersection)));
        }
      }
      const w = (e, t, i, s) => {
          let o = 0;
          const r = s.point.clone().sub(i.pose.position),
            h = (0, n.Tq)(t, r),
            c = Math.max(...h.map((e) => e.score)),
            l = c - 5;
          for (const { sweep: t, score: i } of h)
            if (t) {
              const n = 0 === o ? "cyan" : "orange",
                r = (0, a.dS)(i, l, c, 0, 0.6);
              e.line("panosphere" + o++, n)
                .toggle(!0)
                .updatePositions(s.point, t.position)
                .opacity(r);
              const h = (0, a.dS)(r, 0, 0.6, 0, 0.1);
              e.sphere("panosphere" + o++, { color: n, opacity: 0.8 })
                .toggle(!0)
                .update(t.position, h);
            }
        },
        m = (e, t, i) => {
          let s = 0;
          const o = (0, n.bG)(t, !1, i),
            r = Math.max(...o.map((e) => e.score)),
            h = r - 15;
          for (const { sweep: t, score: n } of o)
            if (t) {
              const o = 0 === s ? "cyan" : "orange",
                c = (0, a.dS)(n, h, r, 0, 1);
              e.line("panosphere" + s++, o)
                .toggle(!0)
                .updatePositions(i.point, t.position)
                .opacity(c);
              const l = (0, a.dS)(c, 0, 1, 0, 0.3);
              e.sphere("panosphere" + s++, { color: o })
                .toggle(!0)
                .update(t.position, l);
            }
        };
      function y(e) {
        e.getModule(r.default).then((t) => {
          const i = t.navigationWalk,
            s = i.positionTracker;
          new NavigationVisuals(e, s, i);
        });
      }
    },
    74135: (e, t, i) => {
      "use strict";
      i.r(t), i.d(t, { default: () => c });
      var s = i(55356),
        o = i(17399),
        a = i(88512),
        n = i(24930),
        r = i(96909);
      const h = new a.Z("raycaster-debug");
      class OctreeDebugMenu {
        constructor(e) {
          Promise.all([
            e.getModule(n.default),
            e.getModuleBySymbol(r.y.WEBGL_RENDERER),
            e.getModule(o.default),
          ]).then(([e, t, i]) => {
            const o = t.getScene(),
              a = [];
            let n = !1;
            const r = () => {
                a &&
                  a.forEach((e) => {
                    e.geometry.dispose(), e.material.dispose(), o.remove(e);
                  });
              },
              c = (e, t, n) => {
                h.info("draw", { from: e, to: t, faces: n });
                const r = i
                  .getOctree()
                  .getDebugBoundsMesh((0, s.rn)().getHex(), e, t, n);
                (r.frustumCulled = !1),
                  r.updateMatrixWorld(!0),
                  o.add(r),
                  a.push(r);
              };
            e.registerMenuButton({
              header: "Raycaster",
              buttonName: "Add Octree Level Buttons",
              callback: () => {
                if (!n) {
                  for (let t = 0; t <= i.getOctree().depth; t++)
                    e.registerMenuButton({
                      header: "Octree Levels",
                      buttonName: `Anything on Level: ${t}`,
                      callback: () => {
                        r(), c(t, t, !1);
                      },
                    });
                  for (let t = 0; t <= i.getOctree().depth; t++)
                    e.registerMenuButton({
                      header: "Octree Faces",
                      buttonName: `Faces on Level: ${t}`,
                      callback: () => {
                        r(), c(t, t, !0);
                      },
                    });
                  n = !0;
                }
              },
            }),
              e.registerMenuButton({
                header: "Raycaster",
                buttonName: "Visualize Octree - All",
                callback: () => {
                  r();
                  for (let e = 0; e <= i.getOctree().depth; e++) c(e, e, !1);
                },
              }),
              e.registerMenuButton({
                header: "Raycaster",
                buttonName: "Visualize Octree - Faces",
                callback: () => {
                  r();
                  for (let e = 0; e <= i.getOctree().depth; e++) c(e, e, !0);
                },
              }),
              e.registerMenuButton({
                header: "Raycaster",
                buttonName: "Clear Octree Visuals",
                callback: r,
              });
          });
        }
      }
      function c(e) {
        new OctreeDebugMenu(e);
      }
    },
    15250: (e, t, i) => {
      "use strict";
      i.r(t), i.d(t, { default: () => m });
      var s = i(96909),
        o = i(2212),
        a = i(37433),
        n = i(19674),
        r = i(74384),
        h = i(12216),
        c = i(24930),
        l = i(59088),
        d = i(44019),
        p = i(25269);
      const u = new (i(88512).Z)("raycaster-debug");
      var g;
      !(function (e) {
        (e.normal = "normal"),
          (e.hitClass = "hitClass"),
          (e.hitBounds = "hitBounds");
      })(g || (g = {}));
      const w = { color: "yellow" };
      class RaycasterDataDebugMenu {
        constructor(e) {
          (this.engine = e),
            (this.cached = {
              v1: new o.Vector3(),
              v2: new o.Vector3(),
              quat: new o.Quaternion(),
            }),
            (this.showClass = !1),
            (this.showName = !0),
            (this.showNormal = !1),
            (this.showBounds = !1),
            (this.drawRaycastHitNormal = (e) => {
              const t = this.draw.line(g.normal, "red", 4);
              e &&
                t.updatePositions(
                  e.point,
                  this.cached.v1.copy(e.point).addScaledVector(e.normal, 0.2)
                ),
                t.toggle(null !== e);
            }),
            (this.drawRaycastObjectInfo = (e, t, i, s) => {
              const o = this.draw.label(g.hitClass, "X", this.cached.v1, 1);
              if (((o.visible = !1), e && t && (i || s))) {
                const { position: a, rotation: r } = t.pose,
                  { point: c, object: l } = e,
                  d = i ? l.__proto__.constructor.name : "",
                  p = s ? ("" !== l.name ? l.name : l.id) : "";
                (o.text = `${d} - ${p}`),
                  o.setPosition(c, (e) =>
                    t.isOrtho()
                      ? e.addScaledVector(h.f.UP, 10)
                      : (0, n.Xe)(a, e, 1, e)
                  ),
                  o.scaleBillboard(
                    a,
                    r,
                    t.pose.projection,
                    t.zoom(),
                    t.height,
                    t.aspect(),
                    0.1
                  ),
                  o.setOrientation(r),
                  (o.visible = !0);
              }
            }),
            (this.drawRaycastHitBounds = (e) => {
              const t = this.draw.boxWire(g.hitBounds, w).toggle(!1);
              if (
                e &&
                e.object &&
                !(e.object instanceof p.i) &&
                e.object instanceof o.Mesh
              ) {
                const i = (0, r.A5)(e.object.geometry),
                  s = i
                    .getCenter(this.cached.v1)
                    .applyMatrix4(e.object.matrixWorld),
                  o = i
                    .getSize(this.cached.v2)
                    .multiply(e.object.scale)
                    .multiplyScalar(0.5);
                t.mesh.quaternion.copy(e.object.quaternion),
                  t.toggle(!0).update(s, o);
              }
            }),
            (this.onPointerDown = () => {
              const e = this.data.hit;
              e && e.object && u.warn(e.object, e);
            }),
            Promise.all([
              e.getModule(c.default),
              e.market.waitForData(d.P),
            ]).then(([e, t]) => {
              this.data = t;
              const i = t.onChanged(() => this.update(t));
              i.cancel();
              const s = (e) => {
                e
                  ? (window.addEventListener("pointerdown", this.onPointerDown),
                    i.renew())
                  : (window.removeEventListener(
                      "pointerdown",
                      this.onPointerDown
                    ),
                    i.cancel(),
                    this.draw.toggleAll(!1));
              };
              e.registerMenuEntry({
                header: "Raycaster",
                setting: "raycasterHitDebugging",
                initialValue: () => !1,
                onChange: (e) => {
                  s(e);
                },
                urlParam: !0,
              }),
                e.registerMenuEntry({
                  header: "Raycaster",
                  setting: "raycasterHitClass",
                  initialValue: () => this.showClass,
                  onChange: (e) => {
                    this.showClass = e;
                  },
                  urlParam: !0,
                }),
                e.registerMenuEntry({
                  header: "Raycaster",
                  setting: "raycasterHitName",
                  initialValue: () => this.showName,
                  onChange: (e) => {
                    this.showName = e;
                  },
                  urlParam: !0,
                }),
                e.registerMenuEntry({
                  header: "Raycaster",
                  setting: "raycasterHitNormal",
                  initialValue: () => this.showNormal,
                  onChange: (e) => {
                    this.showNormal = e;
                  },
                  urlParam: !0,
                }),
                e.registerMenuEntry({
                  header: "Raycaster",
                  setting: "raycasterHitBounds",
                  initialValue: () => this.showBounds,
                  onChange: (e) => {
                    this.showBounds = e;
                  },
                  urlParam: !0,
                });
            });
        }
        get draw() {
          return (
            this._draw ||
              ((this._draw = new a.M({ background: !1, color: "red" })),
              this.engine
                .getModuleBySymbol(s.y.WEBGL_RENDERER)
                .then((e) => this._draw.addToScene(e.getScene()))),
            this._draw
          );
        }
        update(e) {
          const t = this.engine.market.tryGetData(l.M_);
          this.showNormal && this.drawRaycastHitNormal(e.hit),
            this.showBounds && this.drawRaycastHitBounds(e.hit),
            this.drawRaycastObjectInfo(e.hit, t, this.showClass, this.showName);
        }
      }
      function m(e) {
        new RaycasterDataDebugMenu(e);
      }
    },
    90477: (e, t, i) => {
      "use strict";
      i.r(t),
        i.d(t, {
          PanoPreloadVisualizer: () => PanoPreloadVisualizer,
          default: () => b,
        });
      var s = i(88512),
        o = i(96909),
        a = i(37433),
        n = i(38493),
        r = i(24930),
        h = i(59088),
        c = i(44019),
        l = i(75892),
        d = i(27079),
        p = i(35597),
        u = i(35026),
        g = i(2212),
        w = i(12216),
        m = i(29422),
        y = i(69626),
        f = i(31278);
      const M = new s.Z("previs");
      class PanoPreloadVisualizer {
        constructor(e, t, i) {
          (this.engine = e),
            (this.downloadDescriptorGetter = t),
            (this.prioritizer = i),
            (this.allPreloadedSweeps = new Set()),
            (this.active = !1),
            (this.freezeCameraRotation = !1),
            (this.sweepIndex = 50),
            (this.useCurrentCriteria = !0),
            (this.showPreloadIds = !0),
            (this.visualTour = !1),
            (this.showSweepLabels = !1),
            (this.criteria = new d.I6(null, new g.Vector3(), new g.Vector3())),
            (this.draw = new a.M()),
            this.engine
              .getModuleBySymbol(o.y.WEBGL_RENDERER)
              .then((e) => this.draw.addToScene(e.getScene())),
            this.engine.market.waitForData(c.P).then((e) => {
              (this.subscription = e.onChanged(() => this.update(this.draw))),
                this.subscription.cancel();
            });
          const s = this.engine.market.tryGetData(l.Z);
          if (s) {
            this.sweepData = s;
            const e = s.getSweepList(),
              t = new n.Z((e) => e.id);
            for (let i of e)
              i.isObservableProxy && (i = new u.ZP().copy(i)), t.add(i);
            this.sweepMap = t;
          }
          this.engine.getModule(r.default).then((e) => {
            const t = "Pano Preload",
              i = [
                {
                  header: t,
                  setting: "ShowVis",
                  initialValue: () => this.active,
                  onChange: (e) => this.toggle(e),
                },
                {
                  header: t,
                  setting: "Use Camera",
                  initialValue: () => this.useCurrentCriteria,
                  onChange: (e) => {
                    (this.useCurrentCriteria = e), this.update(this.draw);
                  },
                },
                {
                  header: t,
                  setting: "Freeze Rotation",
                  initialValue: () => this.freezeCameraRotation,
                  onChange: (e) => {
                    (this.freezeCameraRotation = e), this.update(this.draw);
                  },
                },
                {
                  header: t,
                  setting: "Show preload ids",
                  initialValue: () => this.showPreloadIds,
                  onChange: (e) => {
                    (this.showPreloadIds = e), this.update(this.draw);
                  },
                },
                {
                  header: t,
                  setting: "Visual tour",
                  initialValue: () => this.visualTour,
                  onChange: (e) => {
                    (this.visualTour = e), this.update(this.draw);
                  },
                },
                {
                  header: t,
                  setting: "Pano labels",
                  initialValue: () => this.showSweepLabels,
                  onChange: (e) => {
                    (this.showSweepLabels = e), this.update(this.draw);
                  },
                },
                {
                  header: t,
                  setting: "Override Sweep",
                  initialValue: () => 0,
                  onChange: (e) => this.updateSweepIndex(e),
                  range: [0, this.sweepMap.count()],
                },
              ];
            e.registerMenuButton({
              header: "Pano Preload tour",
              buttonName: "Tour",
              callback: () => {
                this.activateTourMode();
              },
            }),
              i.forEach((t) => e.registerMenuEntry(t));
          });
        }
        updateSweepIndex(e) {
          const t = Math.round(e);
          (this.sweepIndex = t), this.update(this.draw);
        }
        toggle(e) {
          this.active !== e &&
            (e && this.subscription.renew(),
            e || (this.subscription.cancel(), this.draw.toggleAll(!1)),
            (this.active = e));
        }
        update(e) {
          const t = this.engine.market.tryGetData(l.Z),
            i = this.engine.market.tryGetData(h.M_),
            s = this.engine.market.tryGetData(p.O);
          if (!(e && t && i && s)) return;
          if (!this.active || !this.sweepMap) return;
          if (this.tourMode && !this.visualTour) return;
          const o = t.getSweepList(),
            a = this.useCurrentCriteria
              ? this.prioritizer.priorityCriteria
              : Object.assign({}, this.criteria);
          if (this.useCurrentCriteria) {
            if (this.freezeCameraRotation) {
              if (!a.sweep) return;
              a.cameraPosition.copy(a.sweep.position),
                a.cameraRot.copy(this.lastCriteria.cameraRot),
                a.cameraDir
                  .copy(w.f.FORWARD)
                  .applyQuaternion(this.lastCriteria.cameraRot);
            }
          } else if (
            ((a.sweep =
              this.sweepData.getSweepByIndex(this.sweepIndex) || null),
            !this.freezeCameraRotation)
          ) {
            if (!a.sweep) return;
            a.cameraPosition.copy(a.sweep.position),
              a.cameraRot.copy(i.pose.rotation),
              a.cameraDir.copy(w.f.FORWARD).applyQuaternion(a.cameraRot);
          }
          if (((this.lastCriteria = Object.assign({}, a)), !a.sweep)) return;
          this.tourMode || this.wipePreloadedData();
          const n = [];
          (this.prioritizer.priorityCriteria = a),
            this.prioritizer.filterAndPrioritize(
              n,
              this.sweepMap,
              this.downloadDescriptorGetter
            );
          const r = new Set();
          let c = "";
          for (const e of n)
            e &&
              e.sweep &&
              (r.has(e.sweep.id) ||
                (r.add(e.sweep.id), (c += `${e.sweep.index}, `)),
              this.allPreloadedSweeps.has(e.sweep.id) ||
                this.allPreloadedSweeps.add(e.sweep.id));
          const d = new g.Vector3(0, 0, -1.5).applyQuaternion(i.pose.rotation),
            u = new g.Vector3().copy(i.pose.position).add(d),
            m = `Current Pano: ${a.sweep.index}\n    ${
              this.showPreloadIds ? `Panos: ${c}` : ""
            }\n    Preload Count (this pano): ${r.size}\n    Total Preloaded: ${
              this.allPreloadedSweeps.size
            }`,
            y = e.label("infoLabel", m, u, 0.1);
          if (
            (y.lookAt(i.pose.position),
            y.setPosition(u),
            (y.text = m),
            this.drawSweepSpheres(r, a),
            this.showSweepLabels)
          )
            for (const t of o) {
              const s = `${t.index}`,
                o = e.label(t.id, s, t.position, 0.1);
              (o.text = s), o.setColorHex(16711680), o.lookAt(i.pose.position);
            }
        }
        drawSweepSpheres(e, t) {
          const i = t.sweep;
          if (!i) return;
          this.draw.toggleAll(!1);
          const s = new g.Vector3().copy(i.position);
          s.y += -0.5;
          for (const t of e) {
            const e = this.sweepData.getSweep(t),
              o = i === e,
              a = o ? "green" : "white",
              n = new g.Vector3().copy(e.position);
            if (
              ((n.y += -0.5),
              this.draw
                .sphere(e.id + "sphere" + (o && "source"), {
                  color: a,
                  opacity: 1,
                })
                .update(n, 0.2)
                .toggle(!0),
              !o)
            ) {
              const t = this.draw.line(`${e.id}-${i.id}`, "white", 0.05);
              t.updatePositions(n, s), t.toggle(!0);
            }
          }
        }
        activateTourMode() {
          this.tourMode = !0;
          const e = {},
            t = Math.round(this.sweepIndex),
            i = this.sweepData.getSweepByIndex(t);
          this.engine.commandBinder
            .issueCommand(new m.ju({ sweep: i.id }))
            .then(() => {
              this.wipePreloadedData(), this.allPreloadedSweeps.clear();
              const t = this.sweepData.getSweepList(),
                s = Math.round(0.05 * t.length);
              i && this.tourStep(i, e, s);
            });
        }
        tourStep(e, t, i, s = 0, o = "") {
          const a = e,
            n = this.sweepData.getSweepList();
          let r = e;
          if (!a || a.neighbours.length <= 0) return;
          (t[a.id] = !0),
            (o += `Sweep: ${a.index} Loaded: ${this.allPreloadedSweeps.size}\n`);
          let h = 0;
          for (; h < n.length; ) {
            const e = (a.index + 1 + h) % n.length,
              i = this.sweepData.getSweepByIndex(e);
            if ((h++, i && ((r = i), !t[r.id] && r.id !== a.id && r))) break;
          }
          if (++s <= i)
            if (this.visualTour)
              this.engine.commandBinder
                .issueCommand(
                  new m.ju({
                    sweep: a.id,
                    rotation: (0, y.n0)(a.position, r.position),
                    transition: f.n.Interpolate,
                  })
                )
                .then(() => {
                  setTimeout(() => {
                    this.tourStep(r, t, i, s, o);
                  }, 500);
                });
            else {
              const e = (0, y.n0)(a.position, r.position),
                n = new g.Vector3().copy(w.f.FORWARD).applyQuaternion(e),
                h = new d.I6(a, a.position, n),
                c = [];
              (this.prioritizer.priorityCriteria = h),
                this.prioritizer.filterAndPrioritize(
                  c,
                  this.sweepMap,
                  this.downloadDescriptorGetter
                );
              this.queueToPanoSet(c).forEach((e) =>
                this.allPreloadedSweeps.add(e)
              ),
                this.tourStep(r, t, i, s, o);
            }
          else
            M.info(
              `TOUR END\n      Sweeps visited: ${s}\n      Visual: ${this.visualTour}\n      Sweeps preloaded: ${this.allPreloadedSweeps.size}`
            ),
              M.info(`TOUR INFO\n      ${o}`),
              (this.tourMode = !1);
        }
        queueToPanoSet(e) {
          const t = new Set();
          for (const i of e)
            i && i.sweep && (t.has(i.sweep.id) || t.add(i.sweep.id));
          return t;
        }
        wipePreloadedData() {
          const e = this.sweepData.getSweepList();
          for (const t of e)
            this.downloadDescriptorGetter.deleteAllTileDownloadDescriptors(
              t.id
            );
        }
      }
      function b(e) {
        e.getModuleBySymbol(o.y.SWEEP_PANO).then((t) => {
          const i = t;
          "tileDownloader" in i &&
            new PanoPreloadVisualizer(e, i.tileDownloader, i.tilePrioritizer);
        });
      }
    },
    37433: (e, t, i) => {
      "use strict";
      i.d(t, { M: () => MeshesUtility });
      var s = i(12216),
        o = i(2212);
      class ThreeMesh {
        constructor(e, t, i) {
          return (
            (this.thisType = e),
            (this.container = t),
            (this.mesh = i()),
            (this.mesh.name = `${e.name}`),
            (this.material = this.mesh.material),
            (this.geometry = this.mesh.geometry),
            this
          );
        }
        opacity(e) {
          return (this.material.opacity = e), this;
        }
      }
      function a(e, t) {
        t.forEach((t) => {
          Object.getOwnPropertyNames(t.prototype).forEach((i) => {
            e.prototype[i] = t.prototype[i];
          });
        });
      }
      class AnimatedMeshMixin {
        constructor() {
          this.animationInit = !1;
        }
        initAnimationMixin(e, t) {
          (this.animState = {
            scale: t ? t.clone() : new o.Vector3(1, 1, 1),
            position: e ? e.clone() : new o.Vector3(),
            target: {
              scale: t ? t.clone() : new o.Vector3(1, 1, 1),
              position: e ? e.clone() : new o.Vector3(),
            },
            temp: {
              pos: new o.Vector3(),
              scale: new o.Vector3(),
              makeScale: new o.Vector3(),
            },
          }),
            (this.animationInit = !0);
        }
        update(e, t) {
          if (!this.animationInit)
            throw Error(
              `${AnimatedMeshMixin.name} call this.initAnimationMixin() in ${this.style} constructor to enable update, because I said so.`
            );
          this.mesh.position.copy(e);
          const i = this.vector3From(t);
          return (
            i.equals(this.mesh.scale) || this.mesh.scale.copy(i),
            this.animState.scale.copy(this.mesh.scale),
            this.animState.position.copy(this.mesh.position),
            this.mesh.updateMatrixWorld(!0),
            this
          );
        }
        animate(e, t, i) {
          if (!this.animationInit)
            throw Error(
              `${AnimatedMeshMixin.name} call this.initAnimationMixin() in ${this.style} constructor to enable animations, because I said so.`
            );
          const s = this.vector3From(i);
          this.animState.target.scale.copy(s),
            this.animState.target.position.copy(t);
          const o = this.animState.temp.pos.copy(this.mesh.position).lerp(t, e),
            a = this.animState.temp.scale.copy(this.mesh.scale).lerp(s, e);
          return this.update(o, a), this;
        }
        vector3From(e) {
          if (e instanceof o.Vector3)
            return this.animState.temp.makeScale.copy(e).clamp(r, h);
          if ("number" == typeof e)
            return this.animState.temp.makeScale.set(e, e, e).clamp(r, h);
          throw Error("Unexpected scale input");
        }
      }
      const n = 0.01,
        r = new o.Vector3(n, n, n),
        h = new o.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
      class ToggleAddRemoveMixin {
        toggle(e) {
          return (
            e
              ? this.container.add(this.mesh)
              : this.container.remove(this.mesh),
            (this.isVisible = e),
            this
          );
        }
      }
      class BoxMesh extends ThreeMesh {
        constructor(e, t) {
          super(
            BoxMesh,
            e,
            () =>
              new o.Mesh(
                new o.BoxBufferGeometry(1, 1, 1),
                new o.MeshBasicMaterial(t)
              )
          ),
            (this.container = e),
            (this.style = "Box"),
            (this.mesh.frustumCulled = !1),
            this.geometry.computeBoundingBox(),
            this.initAnimationMixin();
        }
      }
      a(BoxMesh, [AnimatedMeshMixin, ToggleAddRemoveMixin]);
      class BoxWireframeMesh extends ThreeMesh {
        constructor(e, t) {
          super(BoxWireframeMesh, e, () => {
            const e = new o.Box3Helper(
              new o.Box3().setFromCenterAndSize(
                new o.Vector3(),
                new o.Vector3(1, 1, 1)
              )
            );
            return new o.LineSegments(e.geometry, e.material);
          }),
            (this.container = e),
            (this.style = "BoxWireframeMesh"),
            t && this.material.setValues(t),
            (this.mesh.frustumCulled = !1),
            this.initAnimationMixin();
        }
      }
      a(BoxWireframeMesh, [ToggleAddRemoveMixin, AnimatedMeshMixin]);
      class CameraHelperMesh extends ThreeMesh {
        constructor(e, t) {
          super(CameraHelperMesh, e, () => new o.CameraHelper(t)),
            (this.container = e),
            (this.style = "CameraHelper"),
            this.updateCamera(t);
        }
        updateCamera(e) {
          return (
            this.mesh.camera.copy(this.camWithSaneFarDistance(e)),
            this.mesh.update(),
            this
          );
        }
        camWithSaneFarDistance(e) {
          const t = e.clone();
          return (t.far = 5), t;
        }
      }
      a(CameraHelperMesh, [ToggleAddRemoveMixin]);
      class PlaneMesh extends ThreeMesh {
        constructor(e, t) {
          super(
            PlaneMesh,
            e,
            () =>
              new o.Mesh(
                new o.PlaneBufferGeometry(1),
                new o.MeshBasicMaterial(t)
              )
          ),
            (this.container = e),
            (this.style = "PlaneMesh"),
            (this.radius = 1);
          const i = new o.Matrix4();
          i.makeRotationFromEuler(new o.Euler(-Math.PI / 2, 0, 0, "XYZ")),
            this.geometry.applyMatrix4(i),
            (this.mesh.frustumCulled = !1),
            this.initAnimationMixin();
        }
      }
      a(PlaneMesh, [ToggleAddRemoveMixin, AnimatedMeshMixin]);
      class SphereMesh extends ThreeMesh {
        constructor(e, t) {
          super(
            SphereMesh,
            e,
            () =>
              new o.Mesh(
                new o.SphereBufferGeometry(1),
                new o.MeshBasicMaterial(t)
              )
          ),
            (this.container = e),
            (this.style = "SphereMesh"),
            (this.radius = 1),
            (this.mesh.frustumCulled = !1),
            this.initAnimationMixin();
        }
      }
      a(SphereMesh, [ToggleAddRemoveMixin, AnimatedMeshMixin]);
      var c = i(87068);
      class SplineCurveMesh extends ThreeMesh {
        constructor(e, t) {
          return (
            super(
              SplineCurveMesh,
              e,
              () =>
                new o.Line(
                  new o.BufferGeometry(),
                  new o.LineBasicMaterial(
                    Object.assign(
                      { color: c.I.MP_BRAND, opacity: 1, transparent: !0 },
                      t
                    )
                  )
                )
            ),
            (this.container = e),
            (this.positionsBuffer = new o.BufferAttribute(
              new Float32Array(150),
              3
            )),
            (this.point = new o.Vector3()),
            (this.points = {
              start: new o.Vector3(),
              control: new o.Vector3(),
              end: new o.Vector3(),
            }),
            (this.updatePoints = (e, t, i) => {
              this.points.start.copy(this.curve.v0.copy(e)),
                this.points.control.copy(this.curve.v1.copy(t)),
                this.points.end.copy(this.curve.v2.copy(i));
              for (let e = 0; e < 50; e++) {
                const t = e / 49;
                this.curve.getPoint(t, this.point),
                  this.positionsBuffer.setXYZ(
                    e,
                    this.point.x,
                    this.point.y,
                    this.point.z
                  );
              }
              return (this.positionsBuffer.needsUpdate = !0), this;
            }),
            (this.animatePoints = (e, t, i, s) => {
              const { start: o, control: a, end: n } = this.points;
              return o.equals(a) && o.equals(n)
                ? (this.updatePoints(t, i, s), this)
                : (o.lerp(t, e),
                  a.lerp(i, e),
                  n.lerp(s, e),
                  this.updatePoints(o, a, n),
                  this);
            }),
            (this.mesh.frustumCulled = !1),
            (this.curve = new o.QuadraticBezierCurve3(
              new o.Vector3(),
              new o.Vector3(),
              new o.Vector3()
            )),
            this.geometry.setAttribute("position", this.positionsBuffer),
            this.geometry.computeBoundingBox(),
            this
          );
        }
      }
      a(SplineCurveMesh, [ToggleAddRemoveMixin]);
      var l = i(42530),
        d = i(26589),
        p = i(23275);
      class MeshesUtility {
        constructor(e) {
          (this.cache = {}),
            (this.helperCache = {}),
            (this.toggle = (e) => (
              this.options.scene &&
                (e
                  ? this.options.scene.add(this.options.container)
                  : this.options.scene.remove(this.options.container)),
              this
            )),
            (this.box = (e, t) => (
              this.cache[w.box][e] ||
                (this.cache[w.box][e] = new BoxMesh(
                  this.options.container,
                  t
                ).toggle(!0)),
              this.cache[w.box][e]
            )),
            (this.boxWire = (e, t) => (
              this.cache[w.boxWire][e] ||
                (this.cache[w.boxWire][e] = new BoxWireframeMesh(
                  this.options.container,
                  t
                ).toggle(!0)),
              this.cache[w.boxWire][e]
            )),
            (this.cam = (e, t) => (
              this.cache[w.cameraHelper][e] ||
                (this.cache[w.cameraHelper][e] = new CameraHelperMesh(
                  this.options.container,
                  t
                ).toggle(!0)),
              this.cache[w.cameraHelper][e]
            )),
            (this.label = (e, t, i, s = 0.25) => {
              if (!this.labelCreator) {
                const {
                  color: e,
                  backgroundColor: t,
                  backgroundOpacity: i,
                  background: s,
                } = this.options;
                this.labelCreator = new l.u({
                  color: e,
                  background: s,
                  backgroundColor: t,
                  backgroundOpacity: i,
                  wordWrapWidth: 650,
                });
              }
              if (!this.cache[w.label][e]) {
                const o = this.labelCreator.createLabel();
                (this.cache[w.label][e] = o),
                  o.position.copy(i),
                  (o.text = t),
                  (o.scaleFactor = s),
                  this.options.container.add(o);
              }
              return this.cache[w.label][e];
            }),
            (this.line = (
              e,
              t = this.options.lineColor,
              i = this.options.linewidth
            ) => {
              if (!this.cache[w.line][e]) {
                const a = d.default.makeLineMaterial(
                    "string" == typeof t ? new o.Color(t).getHex() : t.getHex(),
                    !1,
                    { linewidth: i }
                  ),
                  n = {
                    onShow: () => this.options.container.add(...r.children),
                    onHide: () => this.options.container.remove(...r.children),
                  },
                  r = new p.c(s.f.ZERO.clone(), s.f.ZERO.clone(), a, n);
                r
                  .updateResolution(window.innerWidth, window.innerHeight)
                  .opacity(1)
                  .toggle(!0),
                  (this.cache[w.line][e] = r);
              }
              return this.cache[w.line][e];
            }),
            (this.plane = (e, t) => (
              this.cache[w.plane][e] ||
                (this.cache[w.plane][e] = new PlaneMesh(
                  this.options.container,
                  t
                ).toggle(!0)),
              this.cache[w.plane][e]
            )),
            (this.sphere = (e, t) => (
              this.cache[w.sphere][e] ||
                (this.cache[w.sphere][e] = new SphereMesh(
                  this.options.container,
                  t
                ).toggle(!0)),
              this.cache[w.sphere][e]
            )),
            (this.spline = (e, t) => (
              this.cache[w.spline][e] ||
                (this.cache[w.spline][e] = new SplineCurveMesh(
                  this.options.container,
                  t
                ).toggle(!0)),
              this.cache[w.spline][e]
            )),
            (this.randomColor = (e) => {
              if (void 0 !== e) {
                if (!this.helperCache[m.color][e]) {
                  const t = new o.Color(u(), u(), u());
                  this.helperCache[m.color][e] = t;
                }
                return this.helperCache[m.color][e];
              }
              return new o.Color(u(), u(), u());
            }),
            (this.randomVector3 = (e) => {
              if (void 0 !== e) {
                if (!this.helperCache[m.vector3][e]) {
                  const t = new o.Vector3(
                    2 * (0.5 - u()),
                    2 * (0.5 - u()),
                    2 * (0.5 - u())
                  );
                  this.helperCache[m.vector3][e] = t;
                }
                return this.helperCache[m.vector3][e];
              }
              return new o.Vector3(
                2 * (0.5 - u()),
                2 * (0.5 - u()),
                2 * (0.5 - u())
              );
            }),
            (this.toggleAll = (e) => {
              for (const t of Object.values(w)) {
                const i = Object.values(this.cache[t]);
                for (const t of i) "toggle" in t && t.toggle(e);
              }
              return this;
            }),
            (this.options = Object.assign(Object.assign({}, g), e));
          for (const e of Object.values(w)) this.cache[e] = {};
          for (const e of Object.values(m)) this.helperCache[e] = {};
          this.options.scene && this.toggle(!0);
        }
        async addToScene(e) {
          return (this.options.scene = e), this.toggle(!0), this;
        }
      }
      const u = () => Math.random(),
        g = {
          lineColor: "white",
          linewidth: 2,
          color: "white",
          background: !0,
          backgroundColor: "white",
          backgroundOpacity: 0.5,
          container: new o.Group(),
        };
      var w, m;
      !(function (e) {
        (e.box = "box"),
          (e.boxWire = "boxWire"),
          (e.label = "label"),
          (e.line = "line"),
          (e.plane = "plane"),
          (e.sphere = "sphere"),
          (e.spline = "spline"),
          (e.cameraHelper = "cameraHelper");
      })(w || (w = {})),
        (function (e) {
          (e.color = "color"), (e.vector3 = "vector3");
        })(m || (m = {}));
    },
  },
]);
